home *** CD-ROM | disk | FTP | other *** search
- !
- ! Copyright (c) 1994
- ! by CompuServe Incorporated, Columbus, Ohio
- !
- ! The information in this software is subject to change without
- ! notice and should not be construed as a commitment by CompuServe.
- !
- ! DISCONCT:
- ! Handles all network/modem disconnections
- ! %LOCAL = 1 if hanging up while network script running
- ! = 2 if hanging up before connection
- !
- !+V
- ! "3.5.2"
- !-V
-
- WaitTime = 10;
- attempts = 0;
-
- CompuServe = 1;
- SprintNet = 2;
- CSIRnet = 16;
- Datex_J = 19;
- Internet = 25;
- Direct = 40;
- Result = %Success;
- ifndef %BreakChar = "#";
-
- DirectConnect = (%Network = Direct) or (%DialType = 2);
-
- ifndef %LOCAL = 0;
- if %LOCAL = 1 goto Do_Local_Hangup;
- if %LOCAL = 2 goto Send_Hangup;
-
- if %Network = Internet goto Exit_Script;
- if %Network = CompuServe goto Start_Wait;
- if %Network = Direct goto Start_Wait;
- if %Network = Datex_J goto Hangup_Datex_J;
- if %Network = SprintNet goto Hangup_SprintNet;
- if %Network = CSIRnet goto Hangup_CSIRnet;
- goto Do_Local_Hangup;
-
- Start_Wait:
- wait
- "XPAD:" goto Hangup_Complete,
- "ITI:" goto Hangup_Complete,
- "Host Name:" goto Send_Bye,
- "User ID:" goto Send_Host,
- "UIC:" goto Send_UIC,
- %mdm_Failure goto Hangup_Complete
- until 80;
- goto Do_Local_Hangup;
-
- Send_Bye:
- send "BYE^M";
- if DirectConnect goto Hangup_Complete;
- goto Wait_NO_CARRIER;
-
- Send_Host:
- send "/HOST^M";
- goto Start_Wait;
-
- Send_UIC:
- send "^C";
- wait until 30;
- goto Start_Wait;
-
- Hangup_SprintNet:
- show "Disconnecting from SprintNet";
- wait
- "disconnected" goto Send_Sprint_Hangup
- until 60;
- goto Do_Local_Hangup;
-
- Send_Sprint_Hangup:
- wait until 3;
- send "HANGUP^M";
- goto Wait_NO_CARRIER;
-
- Hangup_CSIRnet:
- show "Disconnecting from CSIR-Net";
- wait until 40;
- send "Z";
- goto Wait_NO_CARRIER;
-
- Hangup_Datex_J:
- show "Disconnecting from Datex-J";
- wait
- "Host Name:" goto Send_OFF,
- "CLR" goto Clear_PAD
- until 100;
- ! fall through...
-
- Clear_PAD:
- wait until 60;
- send "*9#";
- goto Wait_NO_CARRIER;
-
- Send_OFF:
- send "OFF" & %CR;
- goto Hangup_Datex_J;
-
- Wait_NO_CARRIER:
- if DirectConnect goto Hangup_Complete;
- wait
- "BYE^M" goto Hangup_Complete,
- %mdm_Failure goto Hangup_Complete
- until 30;
-
- sendm %mdm_EscapeCode;
-
- wait
- %mdm_Failure goto Hangup_Complete,
- %mdm_Ack goto Send_Hangup
- until 20;
- ! fall through...
-
- Do_Local_Hangup:
- if DirectConnect goto Hangup_Direct;
-
- wait until 2 * WaitTime;
- sendm %mdm_EscapeCode;
-
- wait
- %mdm_Ack goto End_Escape_Wait,
- %mdm_Failure goto Hangup_Complete
- until 20;
- goto Send_Hangup;
-
- End_Escape_Wait:
- wait until WaitTime;
- ! fall through...
-
- Send_Hangup:
- sendm %mdm_Prefix;
- sendm %mdm_Hangup;
- sendm %mdm_Suffix;
- attempts = attempts + 1;
-
- wait
- %mdm_Ack goto Hangup_Complete,
- %mdm_Failure goto Hangup_Complete
- until 15;
-
- if attempts = 2 goto Hangup_Complete;
- goto Do_Local_Hangup;
-
- Hangup_Direct:
- sendm %BreakChar;
- sendm %BreakChar;
- sendm %BreakChar;
- Hangup_Complete:
- Result = %Cancel;
- if %LOCAL > 0 goto Exit_Script;
- call %Dir & "last.scr" () : Result;
- Exit_Script:
- define %LOCAL = 0;
- exit Result;
-